]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dnd: Factor out calculation into a variable
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Mon, 31 May 2021 00:32:54 +0000 (21:32 -0300)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Mon, 31 May 2021 00:32:54 +0000 (21:32 -0300)
Another trivial cleanup. This is in preparation for next commit, that
will expand on this if clause, and will make it a bit more complicated.
Using a variable here makes it easier to read.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1866>

js/ui/dnd.js

index 252ebb85c3d2d7c1c6bbb062d6d68f79aecfe068..4fbe1acc782bc17511b7467c2131b2209f2c322a 100644 (file)
@@ -508,7 +508,9 @@ var _Draggable = class _Draggable {
         if (!currentDraggable &&
             (Math.abs(stageX - this._dragStartX) > threshold ||
              Math.abs(stageY - this._dragStartY) > threshold)) {
-            if ((event.get_time() - this._dragStartTime) > this._dragTimeoutThreshold) {
+            const ellapsedTime = event.get_time() - this._dragStartTime;
+
+            if (ellapsedTime > this._dragTimeoutThreshold) {
                 this.startDrag(stageX, stageY, event.get_time(), this._touchSequence, event.get_device());
                 this._updateDragPosition(event);
             } else {